$(function(){
	var num = 0;
	$("#scratchpad").wScratchPad({
		width: 198,
		height: 104,
		color: "#a9a9a7",
		scratchMove: function() {
			num++;
			if (num==1) {
				var url = "index.php?go=membership.scratchcard.ajaxAdd";
				var jifen = $("#jifen").text();
				var data = {jifen:jifen};
				$.ajax({
					url  	 : url,
					data 	 : data,
					type  	 : 'POST',
					dataType : 'html',
					success: function(response){
						if(response){
							$(".pop_title").html("对不起");
							$(".ggk_text").html("很遗憾！本次刮刮卡活动，奖品已售馨！");
							showPopUp();
						}
					}
				});
			}
			if(num>200){
				showPopUp();
			}
		}
	});
	$('.ggk_bnt').click(function(){
		hidePopUp();
		location.reload();
	});
});